<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2018/6/21 0021
 * Time: 16:33
 */

namespace app\admin\controller;


use think\Request;

class Adminlog extends Base
{
    //实例化
    protected $_Adminlog;
    public function __construct(Request $request = null){
        parent::__construct($request);
        $this->_Adminlog = new \app\model\model\Adminlog();
    }
    /**
     * 渲染列表页
     * */
    public function lists(){
        return $this->fetch();
    }
    /**
     * 获取列表数据
     * */
    public function getList()
    {
        $data = $this->_Adminlog->getList(false,input('limit'));
        foreach ($data as $v){
            $v['create_time'] = date('Y-m-d H:i:s',$v['create_time']);
        }
        $list = $data->toArray();
        echo json_echo($list);
    }
    /**
     * 删除一个日志
     * */
    public function del(){

        $re = $this->_Adminlog->del(input('id'));
        if($re){
            return json_echo_msg(200,'删除成功！');
        }else{
            return json_echo_msg(400,'删除失败！');
        }
    }
    /**
     * 删除多个日志
     * */
    public function delAll(){

        $re = $this->_Adminlog->delAll(input()['data']);
        if($re){
            return json_echo_msg(200,'删除成功！');
        }else{
            return json_echo_msg(500,'删除失败！');
        }
    }
}